gdkdisplay-wayland: Fix a possibly uninitialized out value
authorTimm Bäder <mail@baedert.org>
Mon, 20 Apr 2020 17:44:14 +0000 (19:44 +0200)
committerTimm Bäder <mail@baedert.org>
Tue, 5 May 2020 06:20:09 +0000 (08:20 +0200)
gdk/wayland/gdkdisplay-wayland.c

index e30acdad1b7f69f1a3566df7d61634807ddc5871..037af89fdb5c908935eea8bdf33a7c49cf22ea3a 100644 (file)
@@ -1287,13 +1287,13 @@ create_shm_pool (struct wl_shm  *shm,
   fd = open_shared_memory ();
 
   if (fd < 0)
-    return NULL;
+    goto fail;
 
   if (ftruncate (fd, size) < 0)
     {
       g_critical (G_STRLOC ": Truncating shared memory file failed: %m");
       close (fd);
-      return NULL;
+      goto fail;
     }
 
   data = mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
@@ -1302,7 +1302,7 @@ create_shm_pool (struct wl_shm  *shm,
     {
       g_critical (G_STRLOC ": mmap'ping shared memory file failed: %m");
       close (fd);
-      return NULL;
+      goto fail;
     }
 
   pool = wl_shm_create_pool (shm, fd, size);
@@ -1313,6 +1313,11 @@ create_shm_pool (struct wl_shm  *shm,
   *buf_length = size;
 
   return pool;
+
+fail:
+  *data_out = NULL;
+  *buf_length = 0;
+  return NULL;
 }
 
 static void